' Written by Craig'n'Dave
Module Module1
    ' Insertion sort
    Function insertion_sort(items() As String)
        Dim n As Integer = items.Count
        Dim index, index2 As Integer
        Dim current As String
        ' Consider all the items
        For index = 1 To n - 1
            current = items(index)
            index2 = index
            ' Find position and move items down one index to make space for new item
            While index2 > 0 AndAlso items(index2 - 1) > current
                items(index2) = items(index2 - 1)
                index2 = index2 - 1
            End While
            ' Insert new item in correct position
            items(index2) = current
        Next
        Return items
    End Function

    Sub Main()
        ' Main program starts here
        Dim items() As String = {"Florida", "Georgia", "Delaware", "Alabama", "California"}
        items = insertion_sort(items)
        Console.WriteLine(String.Join(", ", items))
    End Sub
End Module